package com.yh.serviceimpl;

import com.yh.dao.PermissionDao;
import com.yh.javabean.Permission;
import com.yh.service.PermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("permissionService")
public class PermissionServiceImpl implements PermissionService {
    @Autowired
    PermissionDao permissionDao;
    @Override
    public List<Permission> findAll() {
        //调用mapper方法
        return permissionDao.selectAll();
    }
@Override
public List<Permission> findByUid(int uid) {
        return permissionDao.selectByUid(uid);
}
   /* @Override
    public List<Permission> findByUid(int uid) {
        return permissionDao.selectByUid(uid);
    }*/

    @Override
    public void addPermission(Permission permission) {
        permissionDao.insertPermission(permission);
    }
    @Override
    public void delete(int id) {
        permissionDao.deleteById(id);
    }
    @Override
    public void editPermission(Permission permission) {
        permissionDao.updatePermission(permission);
    }
    @Override
    public Permission findById(int id) {
        return permissionDao.selectById(id);
    }
}
